package com.tek.ding.faceding.presenter.main;

import androidx.annotation.NonNull;

import com.tek.ding.faceding.base.BasePresenter;
import com.tek.ding.faceding.bean.AppVersion;
import com.tek.ding.faceding.bean.BaseBean;
import com.tek.ding.faceding.network.rx.RxHttpResponseCompat;
import com.tek.ding.faceding.network.rx.observable.ProgressDialogObservable;

public class MainPresenter extends BasePresenter<MainContract.IMainModel, MainContract.MainView> {

    public MainPresenter(MainContract.IMainModel model, MainContract.MainView view) {
        super(model, view);
    }

    public void checkVersionV2(String storeUid, String address, String lng, String lat) {
        model.checkNewVersionV2(storeUid, address, lng, lat)
                .compose(RxHttpResponseCompat.compatResult())
                .subscribe(new ProgressDialogObservable<BaseBean<AppVersion>>(context, view) {
                    //不显示提示框
                    @Override
                    protected boolean isShowDialog() {
                        return false;
                    }

                    @Override
                    public void onNext(@NonNull BaseBean<AppVersion> baseBean) {
                        if (baseBean != null) {
                            view.onCheckNewVersionOk(baseBean);
                        }
                    }
                });
    }

}
